#include <cstdio>
#include <iostream>
using namespace std;
int t;
int n;
int memorytosaveinput[200100];
long long hignestpoints=-1;
struct finalgraph
{
    bool coloritem;
    int num;
};
finalgraph answeranswer[200100];
bool meiju[2]={true,false};
int zuijiejin(int index,finalgraph grapher[])
{
    if(index==0)
    {
        return -1;
    }
    finalgraph checkfunc;
    checkfunc=grapher[index];
    for(int i=index-1;i>=0;i--)
    {
        if(grapher[i].coloritem==checkfunc.coloritem)
        {
            return grapher[i].num;
        }
    }
    return -1;
}
void computpoints(finalgraph grapher[])
{
    long long ans=0;
    for(int i=0;i<n;i++)
    {
        if(zuijiejin(i,grapher)==grapher[i].num)
        {
            ans+=grapher[i].num;
        }
    }
    if(ans>hignestpoints)
    {
        hignestpoints=ans;
    }
    return;
}
void creategraph(int index)
{
    if(index==n)
    {
        computpoints(answeranswer);
        return;
    }
    bool buftemp=answeranswer[index].coloritem;
    for(int i=0;i<2;i++)
    {
        answeranswer[index].coloritem=meiju[i];
        creategraph(index+1);
        answeranswer[index].coloritem=buftemp;
    }
}
int main()
{
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    scanf("%d",&t);
    cin.tie(0);
    cout.tie(0);
    for(int allrounds=0;allrounds<t;allrounds++)
    {
        scanf("%d",&n);
        int recieverrr=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&recieverrr);
            memorytosaveinput[i]=recieverrr;
            answeranswer[i].num=recieverrr;
        }
        creategraph(0);
        cout<<hignestpoints<<endl;
        hignestpoints=-1;
    }
    return 0;
}
